#include<bits/stdc++.h>
using namespace std;
const int N=5e5+4;
double a[N];
int n=5000;
signed main(){
    freopen("4.out","r",stdin);
    for(int i=1;i<=n;i++) cin>>a[i];
    freopen("love.out","r",stdin);
    for(int i=1;i<=n;i++){
        double x;
        cin>>x;
        if(fabs(a[i]-x)>fabs(a[i]*1e-5)){
            cerr<<"!!\n";
            cerr<<x<<" "<<a[i]<<"\n";
            cerr<<i<<"\n";
            cout<<"No\n";
            return 0;
        }
    }
    cout<<"Yes";
}